package cn.yyj.springsecurity02.web;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @RequestMapping("test1")
    @PreAuthorize("hasRole('ROLE_ADMIN')")
    public String test1(){
        return "test1";
    }

    @RequestMapping("test2")
    @PreAuthorize("hasRole('ROLE_USER')")
    public String test2(){
        return "test2";
    }
    @RequestMapping("test3")
    @PreAuthorize("hasRole('ROLE_GUEST')")
    public String test3(){
        return "test3";
    }
}
